#include "pch.hpp"

#include "hamster.h"
#include "animation.h"

animation ham_anim;

void hamster::load(sf::Vector2f pos)
{
	position = pos;
	dead = false;
	animate = false;
	randomBlinkTime = 5;

	ham_anim.load("data/hamster.png", 48, 48, 5, 150, false);
}

void hamster::step()
{
	if(ham_timer.GetElapsedTime() > randomBlinkTime)
	{
		ham_timer.Reset();
		randomBlinkTime = rand() % 5 + 3;
	}
}

void hamster::draw()
{
	ham_anim.SetPos(sf::Vector2f(position));
	ham_anim.draw(ham_timer.GetElapsedTime() * 1000);
}